1. Field of the Invention
The present invention relates to an image processing device, an image processing program, and an electronic camera.
2. Description of the Related Art
In general, in an electronic camera, it is known that a color shift occurs in captured image data due to the chromatic aberration of magnification of an optical imaging system. There has been proposed of a conventional technique to correct such a color shift by image processing.
For example, a conventional device disclosed in Japanese Unexamined Patent Application Publication No. 2000-299874 (hereinafter, Document 1) detects a color shift in an edge part of an image first and corrects chromatic aberration of magnification by performing image processing based on the color shift.
Further, a conventional device disclosed in Japanese Unexamined Patent Application Publication No. 2002-344978 (FIG. 1, FIG. 3) (hereinafter, Document 2) performs magnification adjustment for each color component of an image and corrects chromatic aberration of magnification by finding a point at which a difference between color components is minimum.
Furthermore, Japanese Patent No. 2528826 (hereinafter, Document 3) describes a technique for correcting a color shift that occurs at the time of motion image shooting etc, by locally detecting a color shift.
An electronic camera incorporating an image pickup device of single-plate type has color filters of RGB etc. arranged on an image pickup plane and generates RAW data in one kind of color component is arranged on each pixel.
The electronic camera generates image data having all colors on each pixel by generating missing color components of the RAW data through color interpolation processing. Along with the color interpolation processing, false color noises occur in image data. In order to reduce the false color noises, the electronic camera performs spatial frequency low-pass filtering to the chrominance component of the image data (hereinafter, this processing is referred to as “chrominance LPF”).
The inventors of the present application have found that the chrominance LPF and false color causes problems in the detection and correction of the amount of aberration disclosed in the Documents 1 and 2. The problems are as follows.
[Problems Due to Chrominance LPF]
In an image region with a high spatial frequency (that is, an edge part or a fine picture), a slight chrominance change occurs due to a color shift caused by chromatic aberration of magnification. The slight chrominance change will be a chrominance component of a high frequency area and removed by the above-described chrominance LPF. As a result, in the image region with a high spatial frequency, the color shift due to chromatic aberration of magnification is reduced by the chrominance LPF processing.
On the other hand, in an image region with a low spatial frequency (a gradation part with a gradual change), a gradual chrominance change in the low frequency region occurs due to a color shift caused by the chromatic aberration of magnification. The chrominance change in the low frequency region is not removed by the above-described chrominance LPF and allowed to pass. In other words, in the image region with a low spatial frequency, the color shift due to chromatic aberration of magnification remains even after the chrominance LPF processing.
Through such chrominance LPF, in the screen there appear both of a region with the chromatic aberration of magnification reduced and a region with the chromatic aberration of magnification not reduced (an uneven state).
The above-described Documents 1 and 2 premise that the color shift due to chromatic aberration of magnification occurs in point symmetry with respect to the screen center (optical axis center). However, chrominance LPF causes unevenness in the chromatic aberration of magnification and the point symmetry is readily lost. Detection of the amount of aberration in such a state will cause errors in the detection result.
[Problems Due to False Color]
If the chrominance LPF is removed or weakened in order to avoid the problems in the detection and correction of the above-mentioned chromatic aberration of magnification, there arises a problem in turn that the false color noises at the time of color interpolation remains as they are. In this case, the screen is brought into a state in which both of the color shifts due to chromatic aberration of magnification and the false color noises occur in a complex manner. In such a state, errors are likely to occur in the detection result of the amount of aberration.
According to the Documents 1 and 2, in particular, the color shift due to chromatic aberration of magnification is corrected uniformly in the screen, therefore, it is not possible to avoid the errors. Because of this, in a region in which the color shift due to chromatic aberration of magnification has been reduced in advance, it is likely that the correction of color shift acts excessively and a color shift in the opposite direction is generated sometimes. As a result, more complex false color noises occur.
[Problems when Color Shift does not Occur Symmetrically Around a Center Point]
Further, the Documents 1 and 2 are on the premise that the center of the screen of an image is the optical axis of the lens used at shooting, and the chromatic aberration of magnification occurs regularly around the optical axis. Therefore, when a lens used at the shooting is a shift lens or a lens with a hand movement correction function, the chromatic aberration of magnification cannot be corrected since the center thereof shifts from the screen center. Also, in a case where the image to be processed is an image after trimming, it cannot be corrected since the position of the image corresponding to the optical axis is uncertain.
Note that, the above-described Document 3 describes a local detection of a color shift. However, color shift detection is performed on a portion that needs no correction, therefore, the processing takes a lot of time. Further, the color shift detection is made similarly on all of the portions irrespective of the position and structure of a portion to be corrected, requiring extraneous processing time. Furthermore, the correction may not be performed properly.